<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 400px;
            height: 400px;
            background-color: brown;
        }
        span{
            width: 100px;
            height: 100px;
            display: block;
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div>
        aaa
        <span>123</span>
        bbb
    </div>
    <script>
        document.querySelector("body").onclick = function(eve){
            // alert("body被点击了");
            console.log(eve);//输出事件对象
            
        };
        document.querySelector("span").onclick = function(eve){
            // alert("span被点击了");
        };
        document.querySelector("div").onclick = function(eve){
            // alert("div被点击了");
        };
    </script>
</body>
</html>